import Vue from 'vue'
import Router from 'vue-router'
import home from '@/views/home'


Vue.use(Router)

export const webRouterMap = [
  {
    path: '/',
    redirect: '/admin',
    hidden: true
  },
  { path: '/login', component: () => import('@/views/login/index'), name: '登录', hidden: true },
  {
    path: '/admin',
    name: '系统设置',
    component: home,
    iconCls: 'el-icon-platform-eleme',
    children: [
      { path: '/site', component: () => import('@/views/system/site'), name: '站点设置' },
      { path: '/other', component: () => import('@/views/system/other'), name: '其他配置' }
    ]
  },
  {
    path: '/',
    name: '文章发布',
    leaf: true,        //只有一个节点
    component: home,
    iconCls: 'el-icon-s-home',
    children: [
      { path: '/article', component: () => import('@/views/article/index'), name: '文章发布' },
    ]
  },
  {
    path: '/',
    name: '订单管理',
    component: home,
    iconCls: 'el-icon-s-home',
    children: [
      { path: '/order', component: () => import('@/views/order'), name: '订单列表' },
      { path: '/pay', component: () => import('@/views/order/pay'), name: '等待支付' },
    ]
  },
  {
    path: '*',
    redirect: '/admin',
    hidden:true //控制是否在左边菜单栏目展示
  },
]

export default new Router({
  mode: 'history', // 后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: webRouterMap
})
